# Maintainer: Christian Hesse <mail@eworm.de>
# Contributor: Rustam Tsurik <rustam.tsurik@gmail.com>
# Contributor: Nico Suarez <nicodoggie@gmail.com>

pkgname=galera
pkgver=26.4.9
_mariadb_ver=10.6.4
pkgrel=1
pkgdesc='write set replication (WSREP) provider for MariaDB cluster'
arch=('x86_64')
license=('GPL2' 'custom:OpenSSL Linking Exception')
depends=('mariadb' 'openssl')
makedepends=('check' 'scons' 'boost')
optdepends=('rsync: State Snapshot Transfers with rsync'
            'socat: State Snapshot Transfers with mariabackup')
url='https://galeracluster.com/'
options=('!libtool')
validpgpkeys=('199369E5404BD5FC7D2FE43BCBCB082A1BB943DB') # MariaDB Package Signing Key <package-signing-key@mariadb.org>
source=("https://rsync.osuosl.org/pub/mariadb/mariadb-${_mariadb_ver}/galera-${pkgver}/src/galera-${pkgver}.tar.gz"{,.asc})
sha256sums=('8d027efe5de2290235ac476194c2d529ff462a5fe15a8c58570a97aea204b2b1'
            'SKIP')

prepare() {
  cd "${pkgname}-${pkgver}"

  sed -i '/^GALERA_VER/s/API + //' wsrep/tests/SConscript
}

build(){
  cd "${pkgname}-${pkgver}"

  scons system_asio=0
}

package(){
  cd "${pkgname}-${pkgver}"

  install -D -m0755 libgalera_smm.so "${pkgdir}"/usr/lib/galera/libgalera_smm.so
  ln -s galera/libgalera_smm.so "${pkgdir}"/usr/lib/libgalera_smm.so

  install -D -m0755 garb/garbd "${pkgdir}"/usr/bin/garbd

  install -D -m0644 scripts/packages/README "${pkgdir}"/usr/share/doc/galera/README
  install -D -m0644 scripts/packages/README-MySQL "${pkgdir}"/usr/share/doc/galera/README-MySQL
  install -D -m0644 scripts/mysql/README "${pkgdir}"/usr/share/doc/galera/mysql/README
  install -D -m0644 COPYING "${pkgdir}"/usr/share/doc/galera/COPYING
}

